import 'package:flutter_book_store/beans/login_entity.dart';

loginEntityFromJson(LoginEntity data, Map<String, dynamic> json) {
	if (json['jobNumber'] != null) {
		data.jobNumber = json['jobNumber'] is String
				? int.tryParse(json['jobNumber'])
				: json['jobNumber'].toInt();
	}
	if (json['username'] != null) {
		data.username = json['username'].toString();
	}
	if (json['nickName'] != null) {
		data.nickName = json['nickName'].toString();
	}
	if (json['gender'] != null) {
		data.gender = json['gender'] is String
				? int.tryParse(json['gender'])
				: json['gender'].toInt();
	}
	if (json['phone'] != null) {
		data.phone = json['phone'].toString();
	}
	if (json['birth'] != null) {
		data.birth = json['birth'];
	}
	if (json['role'] != null) {
		data.role = json['role'] is String
				? int.tryParse(json['role'])
				: json['role'].toInt();
	}
	if (json['email'] != null) {
		data.email = json['email'].toString();
	}
	if (json['token'] != null) {
		data.token = json['token'].toString();
	}
	return data;
}

Map<String, dynamic> loginEntityToJson(LoginEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['jobNumber'] = entity.jobNumber;
	data['username'] = entity.username;
	data['nickName'] = entity.nickName;
	data['gender'] = entity.gender;
	data['phone'] = entity.phone;
	data['birth'] = entity.birth;
	data['role'] = entity.role;
	data['email'] = entity.email;
	data['token'] = entity.token;
	return data;
}